import request from '@/utils/request'
import { getQueryVariable } from '@/utils/util'

export function getNewClientHistoricalRecord(params) {
  const data = {
    hook_user_id: params.hook_user_id ? params.hook_user_id : undefined,
    user_id: params.user_id ? params.user_id : undefined,
    created_at: params.created_at ? params.created_at : undefined,
    message_body: params.message_body ? params.message_body : undefined,
    page: params.page ? Number(params.page) : 1,
    limit: params.limit ? Number(params.limit) : 10,
    msg_id: params.msg_id,
    sort: 'desc'
  }
  return request({
    url: '/hospital/customer-service/get-client-historical-record',
    method: 'get',
    params: { ...data }
  })
}
export function getImId(unique_id) {
  var _channel = getQueryVariable('_channel')
  if (_channel) {
    return request({
      url: `/auth/tourist`,
      method: 'post',
      data: {
        unique_id,
        register_channel: _channel
      }
    })
  } else {
    return request({
      url: `/auth/tourist`,
      method: 'post',
      data: {
        unique_id
      }
    })
  }
}

export function getUserInfo(token) {
  return request({
    url: `/user/info`,
    method: 'get',
    headers: {
      Authorization: token
    }
  })
}
